package com.xizi.秋招笔试.tx;

import java.util.Scanner;

/**
 * @author xizizzz
 * @description: TODO
 * @date 2021-8-22下午 09:22
 */
public class tx4 {
    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        scanner.nextLine();
        String str = scanner.nextLine();
        int index = 0;
        for (int i = 1; i <= n - k; ) {
            if (str.charAt(i) > str.charAt(index)) {
                index = i;
                i++;
            } else if (str.charAt(i) < str.charAt(index)) {
                i++;
                continue;
            } else {
                int tmp = index;
                while (str.charAt(i) == str.charAt(tmp)) {
                    i++;
                    tmp++;
                }
                if (str.charAt(i) > str.charAt(tmp)) {
                    index = i;
                }
            }
        }
        final String res = str.substring(index, index + k);
        System.out.println(res);
    }
}
